package com.ruoyi.mhorders.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mhorders.mapper.MhOrderMapper;
import com.ruoyi.mhorders.domain.MhOrder;
import com.ruoyi.mhorders.service.IMhOrderService;

/**
 * 会员订单Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-11-16
 */
@Service
public class MhOrderServiceImpl implements IMhOrderService 
{
    @Autowired
    private MhOrderMapper mhOrderMapper;

    /**
     * 查询会员订单
     * 
     * @param id 会员订单主键
     * @return 会员订单
     */
    @Override
    public MhOrder selectMhOrderById(Long id)
    {
        return mhOrderMapper.selectMhOrderById(id);
    }

    @Override
    public MhOrder selectMhOrderByOrderNO(String OrderNO) {
        return mhOrderMapper.selectMhOrderByOrderNO(OrderNO);
    }

    /**
     * 查询会员订单列表
     * 
     * @param mhOrder 会员订单
     * @return 会员订单
     */
    @Override
    public List<MhOrder> selectMhOrderList(MhOrder mhOrder)
    {
        return mhOrderMapper.selectMhOrderList(mhOrder);
    }

    /**
     * 新增会员订单
     * 
     * @param mhOrder 会员订单
     * @return 结果
     */
    @Override
    public int insertMhOrder(MhOrder mhOrder)
    {
        mhOrder.setCreateTime(DateUtils.getNowDate());
        return mhOrderMapper.insertMhOrder(mhOrder);
    }

    /**
     * 修改会员订单
     * 
     * @param mhOrder 会员订单
     * @return 结果
     */
    @Override
    public int updateMhOrder(MhOrder mhOrder)
    {
        mhOrder.setUpdateTime(DateUtils.getNowDate());
        return mhOrderMapper.updateMhOrder(mhOrder);
    }

    /**
     * 批量删除会员订单
     * 
     * @param ids 需要删除的会员订单主键
     * @return 结果
     */
    @Override
    public int deleteMhOrderByIds(Long[] ids)
    {
        return mhOrderMapper.deleteMhOrderByIds(ids);
    }

    /**
     * 删除会员订单信息
     * 
     * @param id 会员订单主键
     * @return 结果
     */
    @Override
    public int deleteMhOrderById(Long id)
    {
        return mhOrderMapper.deleteMhOrderById(id);
    }
}
